#pragma once

#include "resource.h"
#include "Settings.h"
#include "Core.h"
#include "cassiopeialibrary.h"

#define TrayMenu_Active					8
#define TrayMenu_RegisterKeyDevice		9
#define TrayMenu_ClearAllKeyDevices		10
#define TrayMenu_LockAtUnplug			11
#define TrayMenu_StartWithWindows		12
#define TrayMenu_Exit					13

#define TrayMenu_KeyDevicesStart		51

class UI : public Window
{
public:
	UI(HINSTANCE);
	~UI();
	//void Create(HINSTANCE);

private:
	UINT WM_TASKBARCREATED;
	HMENU trayMenu;
	HMENU keyDevicesSubMenu;
	HINSTANCE hInstance;
	NOTIFYICONDATA notifyIconData;
	Core* auroraCore;
	RegisterDriveWindow* registerDriveWindow;
	int unauthorizedAccessCount;

	void CreateTrayMenu();
	void ToggleCoreActiveState();
	bool IsAutorunEnabled();
	bool EnableAutorun(bool);
	void WriteLog();
	void RefreshKeyDevicesMenu();

	static map<Core*, UI*> instances;

	static void CoreLockAtUnplugChanged(Core*, bool);
	static void CoreLockedChanged(Core*, bool);
	static void CoreActiveChanged(Core*, bool);
	static void CoreKeyDevicesChanged(Core*, size_t);
	static void CoreUnauthorizedAccess(Core*);
	
	static void DrivePluggedIn(RegisterDriveWindow*, TCHAR, DWORD, LPVOID, LPVOID);
	static LRESULT CALLBACK WndProc(LPVOID, HWND, UINT, WPARAM, LPARAM);
};

